package com.ptms.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 配置本地教练证件照上传目录的静态资源访问
        // 前端可通过 http://localhost:8080/api/upload/coach-photos/文件名 访问图片
        String uploadPath = "D:/ttns/"; // 本地存储教练证件照的路径
        registry.addResourceHandler("/upload/coach-photos/**")
                .addResourceLocations("file:" + uploadPath);
    }
}
